// 1.1 引入Storage
import { storage } from '@/utils/Storage';
// 1.2 引入常量
import { ACCESS_TOKEN, CURRENT_USER } from '@/store/mutation-types';



// 2.1 获取token
export const getToken = () => {
  return storage.get(ACCESS_TOKEN, '');
}
// 2.2 存储token
export const setToken = (token: string) => {
  storage.set(ACCESS_TOKEN, token, 7 * 24 * 60 * 60 * 1000);
}
// 2.3 移除token
export const removeToken = () => {
  storage.remove(ACCESS_TOKEN);
}
// 2.4 获取用户信息
export const getUserInfo = () => {
  return storage.get(CURRENT_USER, {});
}
// 2.5 存储用户信息
export const setUserInfo = (userInfo: any) => {
  storage.set(CURRENT_USER, userInfo, 7 * 24 * 60 * 60 * 1000);
}
// 2.6 移除用户信息
export const removeUserInfo = () => {
  storage.remove(CURRENT_USER);
}
